package com.sss.hloster02;

public class TestDriver01 {

	public static void main(String[] args) {
		//test02();
		//test01();
		//test03();
		test04();
		
	}
	/**
	 * char类型
	 *
	 */
	private static void test04() {
		// 字符型
		char chVcr1 = '小';
		char chVcr2 = '\u4321';
		char chVcr3 = 'v';
		System.out.println("chaVcr3="+chVcr3);
		System.out.println("chaVcr3="+(int)chVcr3);
		System.out.println("chaVcr3="+(chVcr3+5));
		
		int iVcr1 = chVcr3 + 1;
		System.out.println("iVcr1="+iVcr1);
	}
	
	/**
	 * 基本数据类型的默强制转换
	 */
	private static void test03() {
		//低--高    范围小--范围大
		byte bVcr1 =127;
		byte bVcr2 =(byte) 128;
		//默认自动转换
		int iVcr1 = bVcr1;
		short shVcr1 = (short)iVcr1;
		System.out.println("shVcr1="+shVcr1);
		long lVcr1 = 8989888888887l;
		int iVcr2 = (int)lVcr1;
		System.out.println("iVcr2="+iVcr2);
	}
	
	/**
	 * 基本数据类型的默认（自动）转换
	 */
private static void test02() {
	//低--高    范围小--范围大
	byte bVcr1 = 12;
	int iVcr1 = bVcr1;
	System.out.println("iVcr1 = "+bVcr1);
	//整型默认转换为浮点型
	float fVcr1 = iVcr1;
	//混合表达式
	float fVcr2 = bVcr1 + iVcr1 + fVcr1;
	System.out.println("fVcr2="+fVcr2);
	
	short shVcr1  =2;
	char chVcr1 = 'a';
	char chVcr2 = '\u8887';
	System.out.println("chVcr2="+chVcr2);
	int iVcr3 = bVcr1+shVcr1+chVcr2;
	System.out.println("iVcr3="+iVcr3);
}
	private static void test01() {
		//变量的声明和初始化赋值
		int iVcr1 = 1;
		//先声明，在赋值。
		int iVcr2;
		iVcr2 = 2;
		//浮点数默认类型是double类型
		double dVcr1 = 3.14;
		//float类型需要使用后缀标明
		float fVcr1 = 3.14f;
		
		int iVcr3 = 0555; //8进制
		int iVcr4 = 0x666; //16进制
		byte bVcr1 = (byte)200;//强制类型转换
		//可以使用变量给另外一个变量赋值
		short shVcr1 = (short)iVcr4;
		//输出内容
		System.out.println("shVcr1="+shVcr1);
		
		
	}
  }
	

